-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Dcd cython #929
WIP: Dcd cython #929
Conversation
# always propagate exceptions forward | ||
return False | ||
|
||
def open(self, filename, mode='r'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make this seek like a file object? That's required for my 239 approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make it seek like the XDRFile. It is on the list to add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would that be enough for you or do you need more seek functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just reading through. I'd prefer if seek was what you call bytes_seek
else I'm going to have to have 2 versions of everything though.
On Mon, 8 Aug 2016, 14:20 Max Linke, [email protected] wrote:
In package/MDAnalysis/lib/formats/libdcd.pyx
#929 (comment):
self.open(self.fname, mode)
- def dealloc(self):
self.close()
- def enter(self):
"""Support context manager"""
return self
- def exit(self, exc_type, exc_val, exc_tb):
"""Support context manager"""
self.close()
# always propagate exceptions forward
return False
- def open(self, filename, mode='r'):
would that be enough for you or do you need more seek functionality?
—
You are receiving this because you commented.Reply to this email directly, view it on GitHub
https://github.com/MDAnalysis/mdanalysis/pull/929/files/baacf8a81a69438abce49716167ff7e281bbec4a#r73873127,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI0jB-PKn7kk-nSDAlcD--tdaMBY_hjGks5qdy0DgaJpZM4Jewd6
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also need a tell method if that's possible
On Mon, 8 Aug 2016, 14:21 Richard Gowers, [email protected] wrote:
I'm just reading through. I'd prefer if seek was what you call bytes_seek
else I'm going to have to have 2 versions of everything though.On Mon, 8 Aug 2016, 14:20 Max Linke, [email protected] wrote:
In package/MDAnalysis/lib/formats/libdcd.pyx
#929 (comment):
self.open(self.fname, mode)
- def dealloc(self):
self.close()
- def enter(self):
"""Support context manager"""
return self
- def exit(self, exc_type, exc_val, exc_tb):
"""Support context manager"""
self.close()
# always propagate exceptions forward
return False
- def open(self, filename, mode='r'):
would that be enough for you or do you need more seek functionality?
—
You are receiving this because you commented.Reply to this email directly, view it on GitHub
https://github.com/MDAnalysis/mdanalysis/pull/929/files/baacf8a81a69438abce49716167ff7e281bbec4a#r73873127,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI0jB-PKn7kk-nSDAlcD--tdaMBY_hjGks5qdy0DgaJpZM4Jewd6
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I wrote this should be close to a normal file object. So it will also receive a tell.
So in #916 it came up that there should be a fastio method to read backwards across a DCD file. This would allow for easy negative stepping in the timeseries function. Should this be addressed here or elsewhere? Also I hope you're aware of the work already done by @arose on porting the DCD c files to python3 objects. https://github.com/arose/simpletraj/tree/master/simpletraj/dcd |
I haven't looked much into the API yet. But negative stepping should be possible with a random seek function. Which this class should get like the XDRFile class has. About the fork atom @arose. I'm aware of that but I rather have a clean start then the messy dcd reader we have right now. The cython version will also be easier to maintain in the long run. |
N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and | ||
O. Beckstein. MDAnalysis: A Toolkit for the Analysis of | ||
Molecular Dynamics Simulations. J. Comput. Chem. 32 (2011), 2319--2327, | ||
in press. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope of the PR, but the citation is out of date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also MDAnalysis/MDAnalysis.github.io#27 – you could open a new issue for a new comment header on all files and we can discuss there what we want to put into the new header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And now see #993.
e5aebd6
to
9bad8e7
Compare
This is a good wirst step
[skip ci]
[skip ci]
and fixes other issue I set by accident
See #187 #475 and mdtraj:#1163 |
@kain88-de Is there any way to break the remaining work into manageable chunks? Like, you need a My Cython skills are getting a little more solid, but the interaction between the |
I've updated the first post with a more detailed todo list. The wrapper can now read frames and seek in the dcd file. tests for that would be nice. You can check the libmdaxdr as an example. note |
Yes it's not going to be the short and good looking wrapper I anticipated. But if you have any questions about the code. Just leave a comment. |
|
||
def tell(self): | ||
"""Get current frame""" | ||
return self.current_frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you already defined the tell()
method above? Sorry -- I should have noticed that, but I just realized that my test was passing (once you told me about tell
) before I fetched your update to this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I removed the last commit again
…e handling interface.
…_read_write_mode_file and test_open_wrong_mode.
Currently when I run
Ideas? Is there an openmp issue with python 3 for MDA at the moment? |
I note that this happen on import of MDAnalysis in py35 as well, even though the install appears to work properly. |
@tylerjereddy the If you want to rule out openmp completely, you can hack this line in setup.py to https://github.com/MDAnalysis/mdanalysis/blob/develop/package/setup.py#L277 |
you should be able to set the openmp build in the setup.cfg |
The traceback persists even if I apply both approaches, |
I get the same traceback when I try to run the tests on python 3. I tried to disable openmp in setup.cfg, but I still get the same error. |
@jbarnoud looking at that again, you should be able to comment out that |
@richardjgowers This seems to work as a workaround. I opened an issue to find a proper fix. |
Superseeded by #1155
Fixes #659
Changes made in this Pull Request:
This is a start to completely rewrite the DCD file handling in cython. It will get rid of the convoluted python/C class mixture we have right now and instead replace all DCD file handling in a cleanly wraped
DCDFile
object.DCDFile
is an object that acts similar to normal filehandle in python similar toXTCFile
andTRRFile
. This should also help in #926.At the current stage it is only possible to open/close files.
TODO Cython DCD Wrapper
TODO Update MDAnalysis DCD formats based readers
PR Checklist